import request from '@/utils/request'

// 查询待办任务列表
export function todoList(query) {
  return request({
    url: '/flowable/task/todoList',
    method: 'get',
    params: query
  })
}

// 完成任务
export function completeTask(data) {
  return request({
    url: '/flowable/task/complete',
    method: 'post',
    data: data
  })
}

/**
 * 重新申请任务
 * @param data
 * @returns {AxiosPromise}
 */
export function refillTask(data) {
  return request({
    url: '/flowable/task/refillTask',
    method: 'post',
    data: data
  })
}

// 转办任务
export function transferTask(data) {
  return request({
    url: '/flowable/task/transferTask',
    method: 'post',
    data: data
  })
}

// 委派任务
export function delegateTask(data) {
  return request({
    url: '/flowable/task/delegateTask',
    method: 'post',
    data: data
  })
}

// 认领/签收任务
export function claimTask(data) {
  return request({
    url: '/flowable/task/claim',
    method: 'post',
    data: data
  })
}

// 取消认领/签收任务
export function unClaimTask(data) {
  return request({
    url: '/flowable/task/unClaim',
    method: 'post',
    data: data
  })
}

// 退回任务
export function returnTask(data) {
  return request({
    url: '/flowable/task/returnTask',
    method: 'post',
    data: data
  })
}

// 动态跳转任务
export function dynamicJump(data) {
  return request({
    url: '/flowable/task/dynamicJump',
    method: 'post',
    data: data
  })
}

// 动态跳转任务信息
export function dynamicJumpTask(data) {
  return request({
    url: '/flowable/task/dynamicJumpTask',
    method: 'post',
    data: data
  })
}

// 驳回任务
export function rejectTask(data) {
  return request({
    url: '/flowable/task/rejectTask',
    method: 'post',
    data: data
  })
}

// 可退回任务列表
export function returnList(data) {
  return request({
    url: '/flowable/task/returnList',
    method: 'post',
    data: data
  })
}

// 下一节点
export function getNextFlowNode(data) {
  return request({
    url: '/flowable/task/nextFlowNode',
    method: 'post',
    data: data
  })
}


// 下一节点
export function getNextFlowNodeByRefill(data) {
  return request({
    url: '/flowable/task/nextFlowNodeByRefill',
    method: 'post',
    data: data
  })
}

// 下一节点
export function getNextFlowNodeByStart(data) {
  return request({
    url: '/flowable/task/nextFlowNodeByStart',
    method: 'post',
    data: data
  })
}

// 部署流程实例
export function deployStart(deployId) {
  return request({
    url: '/flowable/process/startFlow/' + deployId,
    method: 'get',
  })
}

// 查询流程定义详细
export function getDeployment(id) {
  return request({
    url: '/system/deployment/' + id,
    method: 'get'
  })
}

// 新增流程定义
export function addDeployment(data) {
  return request({
    url: '/system/deployment',
    method: 'post',
    data: data
  })
}

// 修改流程定义
export function updateDeployment(data) {
  return request({
    url: '/system/deployment',
    method: 'put',
    data: data
  })
}

// 删除流程定义
export function delDeployment(id) {
  return request({
    url: '/system/deployment/' + id,
    method: 'delete'
  })
}

// 导出流程定义
export function exportDeployment(query) {
  return request({
    url: '/system/deployment/export',
    method: 'get',
    params: query
  })
}
// 流程节点表单
export function flowTaskForm(query) {
  return request({
    url: '/flowable/task/flowTaskForm',
    method: 'get',
    params: query
  })
}
export function refillFlowFormData(query) {
  return request({
    url: '/flowable/task/refillFlowFormData',
    method: 'get',
    params: query
  })
}

// 流程节点按钮
export function flowTaskButton(query) {
  return request({
    url: '/flowable/task/flowTaskButton',
    method: 'get',
    params: query
  })
}


// 减签人员
export function getMultiUserList(query) {
  return request({
    url: '/flowable/task/getMultiUserList',
    method: 'get',
    params: query
  })
}
// 多实例加签
export function addMultiInstanceExecution(data) {
  return request({
    url: '/flowable/task/addMultiInstanceExecution',
    method: 'post',
    data: data
  })
}

// 多实例减签
export function deleteMultiInstanceExecution(data) {
  return request({
    url: '/flowable/task/deleteMultiInstanceExecution',
    method: 'post',
    data: data
  })
}
